Skip to content

feat(everything-dev,every-plugin,host,ui): the reverse facade — plugin ui component exports consumable as /$[key]/ui (#1265) - #1266

Open
efizzybot wants to merge 2 commits into
t3/optimize-syntax-and-ssrfrom
t3/reverse-facade-1265
Open

efizzybot wants to merge 2 commits into
t3/optimize-syntax-and-ssrfrom
t3/reverse-facade-1265

Conversation

@efizzybot

Copy link
Copy Markdown
Collaborator

Closes #1265. Stacked on #1264 (base is its branch).

What landed

The pluginsClient shape, mirrored for components — ADR 0010 §3's unbuilt half:

  • Convention: a plugin ui workspace declares ui/src/ui-exports.ts; the generated build exposes it as ./ui (web + node) and publishes its export surface into the manifest's components capability — the discovery block ui: confirm and optimize the @/ui facade path — preload strategy, expose weight, and SSR for remote components #1260 shipped for the core, now collected for every composed source (core: src/components/expose.ts → ./components; plugins: the convention file → ./ui). Absent file, no capability.
  • The generator is multi-source: declarations emit per source into .bos/ui-types/<key>/, and facades emit per (consumer, source) pair — every local ui workspace consumes every other capable source. The core ui is a consumer too: ui/src/ui-remote.gen/$docs/ui/index.ts resolves /$docs/ui (wildcard tsconfig mapping "/*": ["./src/ui-remote.gen/*"]) with remoteComponent("docs", "./ui", ...) — full prop types from docs' emitted declarations, SSR through ui: confirm and optimize the @/ui facade path — preload strategy, expose weight, and SSR for remote components #1260's source-agnostic expose resolver, and the client riding the compose payload's per-source registration.
  • Preloads generalize per source: any composed source whose manifest declares the capability gets its expose's static chunks preloaded from its mf-manifest (dev-local sources derive the manifest URL from the entry). Verified live: the docs remote carried 4 facade preload chunks.
  • First source: docs exposes NavTree + StatusBadge.

Verification

  • Typecheck green across all workspaces with the emitted /$docs/ui facade in the core workspace (typed against docs' declarations).
  • Live dev session: docs exposes routeConfig + ui; /docs still serves the forward facade's SSR markup; the docs remote carries its reverse-facade preloads.
  • Suites: everything-dev facade/manifest units + host 426/426; lint + budget green.

Next slices on this lane (not in this PR)

  • auth.profile.sections migrates off the hand-rolled remoteComponent onto a generated per-source registry (the config-driven section keys need a dynamic-loader map over the generated facades).
  • bos mf check per-consumer capability gates.
  • Remote-only-source types from deployed manifests (today: local sources emit; remote-only skip with a note).
  • Browser spec for a shipped consumer (the first product need lands here).

…n ui component exports consumable as /$[key]/ui (issue #1265)

The pluginsClient shape, mirrored for components (ADR 0010 §3, the unbuilt
half): a plugin ui workspace declares `ui/src/ui-exports.ts` and the build
exposes it as `./ui` (web + node) and publishes its export surface into the
manifest's `components` capability — the same discovery block #1260 shipped
for the core, now collected for every composed source. Consumers typecheck
against generated facades at `/$[key]/ui` (wildcard tsconfig mapping to
`src/ui-remote.gen/$[key]/ui/index.ts`), emitted per (consumer, source) pair
by the generalized facade generator — the core ui is a consumer too.
Server-side, #1260's expose resolver was already source-agnostic, so plugin
components render in the SSR document through the same generation-keyed,
integrity-verified session loads. Preloads generalize per source: any
composed source whose manifest declares the capability gets its expose's
static chunks preloaded from its mf-manifest. First source: docs exposes
NavTree + StatusBadge. Consumer wiring (auth's profile.sections migration
off the hand-rolled remoteComponent, mf-check per-consumer capability gates,
remote-only-source types from deployed manifests) follows as this lane's
next slices.
…container name, narrow /$* mapping, package-only bare re-exports

Review findings on the reverse facade (issue #1265):

1. remoteModule resolved loadRemote by the COMPOSITION KEY while the runtime
   registers containers by MF container name (hydrate + self-registration
   both use remote.name) — every source whose key differs from its container
   name (deployments vs deployments-ui, docs vs _everything_dev_docs_plugin)
   failed client loads with #RUNTIME-004. remoteModule now resolves the
   payload by key (or name) and loads by container name; server-side
   resolution already mapped key -> entry correctly.
2. The generated tsconfig mapping narrowed from /* to /$* — a bare /* would
   shadow absolute-style /x imports across the workspace.
3. Facades re-export only package specifiers: a workspace-alias bare
   re-export (@/..., #/...) in a source barrel would have resolved against
   the CONSUMER's tree — wrong types or a missing module.
4. The loadRemote-by-key behavior the old unit test encoded is corrected to
   assert the container-name load; rationale recorded in ADR 0064.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants